Efficient Machine Learning (ML) Model for Classification

ABSTRACT

Techniques for implementing an efficient machine learning (ML) model for classification are provided. In one set of embodiments, a computer system can receive a query data instance to be classified. The computer system can then generate a first classification result for the query data instance using a first (i.e., primary) ML model, where the first classification result includes a predicted class for the query data instance and a confidence level indicating a likelihood that the predicted class is correct, and compare the confidence level with a classification confidence threshold. If the confidence level is greater than or equal to the classification confidence threshold, the computer system can output the first classification result as a final classification result for the query data instance. However, if the confidence level is less than the classification confidence threshold, the computer system can forward the query data instance to one of a plurality of second (i.e., secondary) ML models for further classification.

BACKGROUND

In machine learning (ML), classification is the task of predicting, fromamong a set of predefined classes, the class to which a given data pointor observation (i.e., “data instance”) belongs using a trainedmathematical model (i.e., “ML model”). Anomaly detection is a particularuse case of classification that involves predicting whether a datainstance belongs to a “normal” class or an “anomaly” class, under theassumption that most data instances are in fact normal rather thananomalous. Example applications of anomaly detection include identifyingfraudulent financial transactions, detecting faults in safety-criticalsystems, facilitating medical diagnoses, and detectingintrusions/attacks in computer networks.

With the proliferation of IoT (Internet of Things) and edge computing,it is becoming increasingly useful/desirable to offload certaincomputing tasks, including ML-based classification/anomaly detection,from centralized servers to edge devices such as IoT-enabled sensors andactuators, home automation devices and appliances, mobile devices, IoTgateways, and so on. However, traditional ML models forclassification/anomaly detection generally rely on monolithicclassifiers that exhibit a large memory footprint, relatively longtraining time (and thus high power consumption), and relatively highclassification latency. As a result, these traditional ML models cannotbe implemented as-is on edge devices, which are often constrained interms of their memory, compute, and/or power resources.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts a traditional ML model comprising a monolithicclassifier.

FIG. 2 depicts the architecture of a lightweight and efficient ML modelfor classification/anomaly detection (i.e., REC model) according tocertain embodiments.

FIG. 3 depicts a training workflow that may be carried out by the RECmodel of FIG. 2 according to certain embodiments.

FIG. 4 depicts a classification (i.e., query) workflow that may becarried out by the REC model of FIG. 2 according to certain embodiments.

FIG. 5 depicts a hierarchical version of the REC model of FIG. 2according to certain embodiments.

DETAILED DESCRIPTION

In the following description, for purposes of explanation, numerousexamples and details are set forth in order to provide an understandingof various embodiments. It will be evident, however, to one skilled inthe art that certain embodiments can be practiced without some of thesedetails or can be practiced with modifications or equivalents thereof.

1. Overview

Embodiments of the present disclosure are directed to a lightweight andefficient ML model for classification (and more specifically, anomalydetection). Generally speaking, this ML model—referred to herein as the“REC” (resource-efficient classification) model—is composed of two modellayers: a first layer comprising a “primary” ML model and a second layercomprising a number of “secondary” ML models.

When a query (i.e., unknown/unlabeled) data instance is received forclassification, the REC model can initially pass the data instance tothe primary ML model, which is designed to be small in memory size andcapable of handling the classification of “easy” data instances (i.e.,those that can be classified with a high degree of confidence). Uponreceiving the data instance, the primary ML model can generate aclassification result that includes (1) a predicted classification forthe data instance and (2) an associated confidence level indicating theempirical probability/likelihood that the predicted classification iscorrect. If this confidence level matches or exceeds a predefinedconfidence threshold (referred to herein as the classificationconfidence threshold, or the), the REC model can output the primary MLmodel's classification result as the final classification result for thedata instance and terminate its processing.

However, if the confidence level generated by the primary ML model isbelow the (indicating that the primary model is uncertain about itspredicted classification), the REC model can forward the data instanceto one of the secondary ML models. In various embodiments, each of thesesecondary ML models can be explicitly trained to classify “hard” datainstances that the primary ML model is unsure about (or in other words,is unable to classify with a sufficiently high confidence level). Forexample, if there are two possible classes C1 and C2, a first secondaryML model may be trained to classify data instances which the primary MLmodel thinks (but is not certain) belongs to C1, and a second secondaryML model may be trained to classify data instances which the primary MLmodel thinks (but is not certain) belongs to C2. In response toreceiving the forwarded data instance, the appropriate secondary MLmodel can generate a classification result for the data instance basedon its training and the REC model can output the secondary ML model'sclassification result as the final classification result for the datainstance.

With the general design and approach above, the REC model can achieve alevel of classification accuracy that is similar to traditional MLmodels which are based on monolithic classifiers, but with significantlyimproved training time, classification latency, and memory consumption.Thus, the REC model advantageously enables ML-based classification to beperformed on computing devices that have limited compute, memory, and/orpower resources, such as edge devices in an IoT deployment. Theforegoing and other aspects of the present disclosure are described infurther detail in the sections that follow.

It should be noted that several of the embodiments and examplespresented below discuss the REC model in the specific context of anomalydetection, which as mentioned previously involves the classification ofdata instances into one of two classes, normal and anomaly. This focuson anomaly detection simplifies the discussion because there are onlytwo classes to consider, and also highlights the benefits of the RECmodel because the uneven distribution of data instances across thenormal and anomaly classes generally results in even faster training andlower average classification latency than other classification usecases. However, the REC model is not solely limited to anomaly detectionand may be broadly applied to any type of classification task comprisingany number of classes, with any kind of data distribution across thoseclasses.

2. Model Architecture

To provide context for the REC model described herein, FIG. 1 depicts atraditional ML model 100 for anomaly detection comprising a monolithicclassifier 102 and a classification workflow that may be executed by themodel. Classifier 102 is “monolithic” in the sense that it represents asingular and typically large/complex instance of a particular MLclassification algorithm, such as a random forest (RF) classifier, anartificial neural network (ANN), a naive Bayes classifier, etc.

During an initial training phase (not shown), traditional ML model 100can receive training data instances from a training data set, where eachtraining data instance is labeled as belonging to the normal class orthe anomaly class. Based on this training data set, traditional ML model100 can adjust various internal parameters of monolithic classifier 102in a manner that enables model 100 to learn the correct (i.e., labeled)class for each training data instance, as well as other data instancesthat are similar to the training data instances.

Then during a classification, or “query,” phase (shown in FIG. 1),traditional ML model 100 can receive a query data instance D (referencenumeral 104) and generate, via monolithic classifier 102, aclassification result R indicating the model's predicted classificationfor data instance D (i.e., normal or anomaly), as well as a confidencelevel for the predicted classification (reference numeral 106). Theexact format of this classification result can vary depending on thetype of monolithic classifier 102. For example, in the scenario whereclassifier 102 is an RF classifier, the classification result can takethe form of a class distribution vector which includes, for each of thenormal and anomaly classes, a confidence level value indicating theprobability/likelihood that data instance D belongs to that class (e.g.,[normal=0.78, anomaly=0.22]). In this scenario, the predictedclassification generated by model 100 can correspond to the class withthe highest associated confidence level within the vector. Generallyspeaking, the sum of the various per-class confidence levels will equal1; thus, in the anomaly detection use case where there are exactly twoclasses, the possible range of confidence level values for the predictedclassification (i.e., the class with the highest confidence value) willbe 0.5 to 1.

As noted in the Background section, one issue with employing atraditional ML model like model 100 of FIG. 1 for classification/anomalydetection is that, due to the monolithic nature of its classifier 102,model 100 is not particularly efficient in terms of memory footprint,power consumption, training time, and classification latency. While thisis acceptable if traditional ML model 100 is run on a computingdevice/system with significant compute/memory/power resources (e.g., adedicated server), these limitations mean that model 100 cannot beeasily implemented on less capable devices/systems, such as edge devices(e.g., mobile devices, sensors, actuators, appliances, etc.) in an IoTor edge computing deployment.

To address the foregoing and other similar issues, FIG. 2 depicts thearchitecture of a novel ML model 200 (referred to herein as the REC, or“resource-efficient classification” model) that may be used for anomalydetection according to certain embodiments. As shown, REC model 200 iscomposed of two model layers: a first layer comprising a primary MLmodel (M_(p)) 202 and a second layer comprising two secondary ML models(M_(s) ¹ and M_(s) ²) 204 and 206 (one for the normal and anomalyclasses respectively). In addition, REC model 200 includes a dataforwarder 208 sitting between primary ML model 202 and secondary MLmodels 204/206.

At a high level, primary ML model 202 can be implemented using asmall/simple ML classifier (e.g., an RF classifier with only a few treesand low maximum depth) and can handle the classification of easy datainstances that clearly belong to one class or the other. In the contextof anomaly detection, this will correspond to the majority ofclassification queries because most data instances will be obviouslynormal. For example, as shown via reference numerals 210-214 in FIG. 2,REC model 200 can receive a query data instance D1 and pass it toprimary ML model 202. Primary ML model 202 can generate a classificationresult R1 for D1 that identifies D1 as being normal with a confidencelevel matching or exceeding a predefined classification confidencethreshold th_(c), indicating that primary model 202 is highly confidentin this predicted classification. In response, RCE model 200 candirectly output R1 as the final classification result for D1 andterminate its processing.

In contrast to primary ML model 202, secondary ML models 204 and 206 canbe implemented using larger/more complex ML classifiers (e.g., RFclassifiers with more trees and greater maximum depth) and can beexplicitly trained to be “experts” in classifying hard data instancesthat primary ML model 202 is unsure about (i.e., data instances whichmodel 202 has classified with low confidence). Thus, for such hard datainstances, rather than accepting the low-confidence classificationsgenerated by primary ML model 202, REC model 200 can forward the datainstances to an appropriate secondary ML model 204/206 for furtherclassification.

For example, as shown via reference numerals 216-224 of FIG. 2, in thescenario where REC model 200 receives a query data instance D2 thatprimary ML model 202 classifies as normal with low confidence (i.e.,generates a classification result R2_(p) indicating that D2 is normalwith a confidence level below the), data forwarder 208 can forward D2from primary ML model 202 to secondary ML model 204 (which is trained tohandle low-confidence “normal” classifications). Secondary ML model 204can then generate its own classification result R2_(s) for data instanceD2, which REC model 200 can thereafter output as the finalclassification result for D2.

The specific way in which secondary ML models 204/206 are trained to beexperts in classifying the data instances that are difficult for primaryML model 202 is detailed in section (3) below, but generally speakingthis training can be driven by the confidence levels generated byprimary ML model 202 in a manner similar to how classification iscarried out as explained above. For instance, at the time of receiving atraining data set, the entire training data set can first be used totrain primary ML model 202. Then, for each training data instance in thetraining data set, the training data instance can be classified by thetrained version of primary ML model 202 and a classification result canbe generated. If the classification result includes a confidence levelthat is greater than or equal to a predefined training confidencethreshold th_(t), that means primary ML model 202 can adequately handlethe classification of that data instance (and other similar datainstances) and no further training with respect to the data instance isneeded.

However, if the classification result generated by primary ML model 202includes a confidence level that is less than th_(t), that means this isa hard data instance for model 202 to classify. Thus, the training datainstance can be forwarded to the appropriate secondary ML model 204/206that is intended to be an expert for hard data instances of the classidentified by primary ML model, and that secondary ML model can betrained using the training data instance.

More particularly, secondary ML model 204 (M_(s) ¹), which is designatedto be an expert in classifying data instances which primary ML model 202(M_(p)) has identified as normal but is unsure about, will be trained onall such “normal” training data instances (as determined by M_(p)) whosecorresponding M_(p) confidence levels fall between 0.5 and th_(t).Similarly, secondary ML model 204 (M_(s) ²), which is designated to bean expert in classifying data instances which primary ML model 202(M_(p)) has identified as anomalous but is unsure about, will be trainedon all such “anomaly” training data instances (as determined by M_(p))whose corresponding M_(p) confidence levels fall between 0.5 and th_(t).Thus, secondary ML models 204 and 206 will only be trained on specificfractions of the overall training data set that correspond to the harddata instances for primary ML model 202.

With regards to classification, secondary ML model 204 (M_(s) ¹) willonly classify unknown data instances that are determined to be normal byprimary ML model 202 and whose corresponding M_(p) confidence levelsfall between 0.5 and th_(c), and secondary ML model 206 (MD will onlyclassify unknown data instances that are determined to anomalous byprimary ML model 202 and whose corresponding M_(p) confidence levelsfall between 0.5 and th_(c). All other “easy” data instances will bedirectly handled by primary ML model 202 (which will typically accountfor the majority of classification queries in the anomaly detection usecase).

It should be noted that th_(c) (which is used to drive classification)can be equal or less than th_(t) (which is used to drive training). Onereason for setting th_(c) to be less than th_(t) is to ensure that eachsecondary ML model 204/206 is trained with a larger range of trainingdata instances (in terms of primary confidence level) than the range ofquery data instances that will be forwarded to that secondary model atthe time of classification. This advantageously allows each secondary MLmodel 204/206 to be more robust and less sensitive to possible smallvariances in confidence level values generated by primary ML model 202.In other embodiments, the can be set to be exactly equal to the th_(t).

With the model architecture presented in FIG. 2 and the foregoingdescription, a number of benefits are achieved. First, because primaryML model 202 is based on a small ML classifier and secondary ML models204 and 206 are trained on relatively small subsets of the overalltraining data set, the training time and memory footprint required byREC model 200 will generally be less than the training time and memoryfootprint required by traditional ML models that rely on monolithicclassifiers like model 100 of FIG. 1. This enables REC model 200 toconsume less power and memory during its runtime operation, which inturn allows the model to be implemented on battery-powered and/ormemory-constrained devices/systems such as mobile devices, appliances,embedded systems, etc.

Second, because small primary ML model 202 can successfully classify themajority of query data instances (i.e., classification queries) in theanomaly detection use case, with only a small fraction of classificationqueries being forwarded to secondary ML models 204 and 206, theclassification latency exhibited by REC model 200—or in other words, theamount of time needed for the model to generate a final classificationresult—will generally be substantially lower than that of traditional MLmodels. This facilitates the implementation of REC model 200 oncompute-constrained device/systems, and also opens the door for newanomaly detection applications that require extremely low latency times.

The remaining sections of the present disclosure provide additionaldetails regarding the training and classification workflows for RECmodel 200, as well as various model enhancements and extensions. Itshould be appreciated that the model architecture shown in FIG. 2 isillustrative and not intended to be limiting. For example, although RECmodel 200 is depicted as comprising exactly two secondary ML models 204and 206 corresponding to the normal and anomaly classes in the anomalydetection use case, as mentioned previously the REC model is not limitedto anomaly detection and can be applied to more general classificationtasks (i.e., the classification of data instances across k classes withany data distribution across the classes). In these alternativeembodiments, the number of secondary ML models incorporated into RECmodel 200 may be equal to k, less than k, or greater than k, dependingon the specific confidence level-driven criteria that are used topartition training and query data instances across those models.

Further, although REC model 200 is generally assumed to be a singularentity that is run on a single computing device/system, in someembodiments the sub-models of REC model 200 (i.e., primary ML model 202and secondary ML models 204 and 206) may be distributed across multiplecomputing devices/systems for enhanced performance, reliability, faulttolerance, or other reasons. For example, in a particular embodiment,primary ML model 202 may be deployed on an edge device in an IoTdeployment while secondary ML models 204 and 206 may be deployed on oneor more servers in the cloud. One of ordinary skill in the art willrecognize other variations, modifications, and alternatives.

3. Training Workflow

FIG. 3 depicts a workflow 300 for training REC model 200 of FIG. 2according to certain embodiments. Starting with blocks 302 and 304, atraining data set X comprising labeled training data instances can bereceived and primary ML model 202 can be trained using the entirety ofX.

Once primary ML model 202 has been trained, a loop can be entered foreach training data instance x in training data set X (block 306). Withinthis loop, primary ML model 202 can classify training data instance xand thus generate a classification result for x comprising a predictedclassification (i.e., normal or anomaly) and an associated confidencelevel (block 308). This confidence level can then be evaluated againstpredefined training confidence threshold th_(t) (block 310).

If the confidence level is greater than or equal to th_(t), the end ofthe current loop iteration can be reached (block 312) and workflow 300can return to the top of the loop (block 306) in order to process thenext training data instance in training data set X.

However, if the confidence level is less than th_(t), data forwarder 208can forward x to an appropriate secondary ML model 204/206 in accordancewith its primary classification generated at block 308 (block 314). Forexample, if primary ML model 202 determined at block 308 that x isnormal, data forwarder 208 will forward x to secondary ML model 204(which is designated to be an expert in classifying such low-confidence“normal” data instances). Conversely, if primary ML model 202 determinedat block 308 that x is anomalous, data forwarder 208 will forward x tosecondary ML model 206 (which is designated to be an expert inclassifying such low-confidence “anomaly” data instances).

It should be noted that data forwarder 208 does not forward trainingdata instance x at block 314 in accordance with the training datainstance's true (i.e., labeled) class. This is because the goal intraining secondary ML models 204 and 206 is to have them succeed in thecases where primary ML model 202 may fail. Thus, the training datainstances forwarded to a given secondary ML model 204/206 should includeboth (1) low-confidence data instances that truly belong to theircorresponding labeled class, and (2) low-confidence data instances thatdo not belong to their labeled class, but primary ML model 202 believesthat they do. This ensures that each secondary ML model 204/206 becomesan expert in classifying the data instances that primary ML model 202may incorrectly classify.

At block 316, the secondary ML model 204/206 that receives training datainstance x from data forwarder 208 can be trained using x. Upon trainingthe secondary ML model, the end of the current loop iteration can bereached as before (block 312) and workflow 300 can return to block 306in order to process the next training data instance in training data setX. Finally once all of the training data instances in training data setX have been processed, workflow 300 can end.

To further clarify the nature of training workflow 300, the following isa pseudo-code representation of workflow 300 according to certainembodiments. In this pseudo-code representation, it is assumed thatcoarse grained ML model 202 (i.e., M_(p)) employs an RF classifier andthus generates a class distribution vector d_(x) as its classificationresult for each training data instance x. The two representations areotherwise largely similar (with line 1 below corresponding to block 304of workflow 300 and lines 4-10 below roughly corresponding to blocks306-316 of workflow 300).

Listing 1 Inputs: Labeled training data set X, training confidencethreshold th_(t)  1: train M_(p) using X  2: for each class y:  3: set:data[y] = Ø  4: for each x ∈ X:  5: obtain primary class distributionvector d_(x) = M_(p)(x)  6: if max(d_(x)) < th_(t):  7: classify: y =argmax(d_(x))  8: update: data[y].append(x)  9: for each y ∈ {i |data[i] ≠ Ø}: 10: train M_(s) ^(y) using data[y]

It should be appreciated that training workflow 300 of FIG. 3 isillustrative and various modifications are possible. For example, insome scenarios each training data instance x of training data set X willbe composed of a plurality of features (such as, e.g., a vector of fvalues). In these scenarios, primary ML model 202 may be trained usingonly a selected subset g<f of the features of each training datainstance, rather than the entire feature set. Feature subset g may beselected based on various factors/criteria, such as the anomalydetection application to which REC model 200 is being applied,deployment constraints, the relative importance/significance of thefeatures, etc. With this approach, the training time and memoryfootprint of REC model 200 can be further reduced, at the expense ofsome classification accuracy. In the case where a training data instanceis forwarded to a secondary ML model 204/206 due to a low-confidenceclassification generated by primary ML model 202, the secondary ML modelmay utilize feature subset g or alternatively the entire feature set ffor its training.

Further, although workflow 300 indicates that data forwarder 208forwards low-confidence training data instances (i.e., those trainingdata instances that primary ML model 202 cannot classify with certaintyper th_(t)) to a single secondary ML model 204/206 for training, in someembodiments data forwarder 208 may specifically forward low-confidencetraining data instances that are labeled as “anomaly” to both secondaryML models 204 and 206. The intuition behind this modification is thatthe anomaly class will generally be significantly smaller than thenormal class in terms of the number of data instances (and itslow-confidence subset will be even smaller), which leads to twoproblems: (1) less accurate classification of anomalous data instancesby primary ML model 202, and (2) increased probability of overfitting bythe secondary ML models. By forwarding low-confidence, truly anomaloustraining data instances to both secondary ML models for training, thelikelihood of (1) and (2) occurring can be reduced and each secondary MLmodel can become a better expert for those classification queries inwhich primary ML model 202 is more likely to make a classificationmistake.

Listing 2 below is a pseudo-code representation of this modified versionof training workflow 300 according to certain embodiments:

Listing 2 Inputs: Labeled training data set X, training confidencethreshold th_(t)  1: train M_(p) using X  2: set: data[s₁] = Ø  3: set:data[s₂] = Ø  4: for each x ∈ X:  5: obtain primary class distributionvector d_(x) = M_(p)(x)  6: if max(d_(x)) < th_(t):  7: if x.label ==anomaly:  8: update: data[s₁].append(x)  9: update: data[s₂].append(x)10: else: 11: classify: y = argmax(d_(x)) 12: if y == normal: 13:update: data[s₁].append(x) 14: else: 15: update: data[s₂].append(x) 16:train M_(s) ¹ using data[s₁] 17: train M_(s) ² using data[s₂]

4. Classification (Query) Workflow

FIG. 4 depicts a classification (i.e., query) workflow 400 that may beexecuted by REC model 200 of FIG. 2 according to certain embodiments.Workflow 400 assumes that REC model 200 has been trained via trainingworkflow 300 of FIG. 3.

Starting with blocks 402 and 404, REC model 200 can receive a query(i.e., unknown/unlabeled) data instance x and pass it to primary MLmodel 202, which can classify it and generate a classification resultcomprising a predicted classification for x and an associated confidencelevel.

At block 406, REC model 200 can check whether the confidence level isgreater than or equal to classification confidence threshold th_(c). Ifso, REC model 200 can return the classification result generated byprimary ML model 202 as the final classification result for x (block408) and workflow 400 can end.

However, if the confidence level is less than th_(c), REC model 200 canforward x, via data forwarder 208, to an appropriate secondary ML model204/206 in accordance with the primary classification generated at block404 (block 410). For example, if primary ML model 202 determined atblock 404 that x is normal, data forwarder 208 will forward x tosecondary ML model 204 (which has been trained to be an expert inclassifying such low-confidence “normal” data instances). Conversely, ifprimary ML model 202 determined at block 404 that x is anomalous, dataforwarder 208 will forward x to secondary ML model 206 (which has beentrained to be an expert in classifying such low-confidence “anomaly”data instances).

Finally, at blocks 412 and 414, the secondary ML model that receivesquery data instance x from data forwarder 208 can generate aclassification result for x and REC model 200 can output that secondaryclassification result as the final classification result for x. Workflow400 can subsequently end.

To further clarify the nature of classification workflow 400, thefollowing is a pseudo-code representation of workflow 400 according tocertain embodiments. Similar to previous pseudo-code listings 1 and 2,it is assumed that coarse grained ML model 202 (i.e., M_(p)) andsecondary ML models 204/206 (i.e., M_(s) ^(y) for y=1, 2) employ RFclassifiers and thus each generates a class distribution vectord_(x)/d_(x)′ as its classification result for query data instance x.

Listing 3 Inputs: Query data instance x, classification confidencethreshold th_(c) 1: obtain primary class distribution vector d_(x) =M_(p)(x) 2: classify: y = argmax(d_(x)) 3: if max(d_(t)) ≥ th_(c): 4:return y 5: else: 6: obtain primary class distribution vector d_(x)′ =M_(s) ^(y) (x) 7: classify: y′ = argmax(d_(x)′) 8: return y′

It should be appreciated that classification workflow 400 of FIG. 4 isillustrative and various modifications are possible. For example, asnoted with respect to training workflow 300 of FIG. 3, in someembodiments primary ML model 202 may be trained using only a selectedsubset g<f of the features of each training data instance received byREC model 200. In these embodiments, at the time of receiving a querydata instance x for classification (which will have the same feature setf as the training data instances), primary ML model 202 may perform itsclassification of x by only taking into account feature subset g, ratherthan x's entire feature set f. This can further reduce theclassification latency of REC model 200. In the scenario where querydata instance x is forwarded to a secondary ML model 204/206 due to alow-confidence classification generated by primary ML model 202, thesecondary ML model may classify x using feature subset g oralternatively the entire feature set f.

Further, in some cases primary ML model 202 may generate aclassification result for a query data instance x with a confidencelevel that is very low (e.g., close to 0.5). This level of confidenceindicates that primary ML model 202 is highly unsure of itsclassification of x, to the point where the classification can beconsidered arbitrary/random. In these situations, REC model 200 canemploy a “quorum-based” approach in which REC model 200 forwards x toboth secondary ML models 204 and 206, rather than to a single secondarymodel, for further classification. Upon receiving the classificationresults generated by each secondary ML model, REC model 200 can selectthe secondary classification that has the highest confidence level andoutput that classification as the final classification result. In thisway, REC model 200 can simultaneously leverage both secondary ML modelsto try and obtain an accurate classification for x, given the degree ofuncertainty exhibited by primary ML model 202.

Yet further, in certain embodiments REC model 200 can forwardlow-confidence classifications generated by secondary ML models 204/206to an external ML model, such as a large ML model hosted in the cloud.This external ML model may use a monolithic classifier such asclassifier 102 depicted in FIG. 1 and/or may employ a different type ofclassification algorithm/method than those employed by secondary MLmodels 204/206 or primary ML model 202. For example, if models202/204/206 are based on RF classifiers, the external ML model may bebased on an ANN. Upon receiving the classification result generated bythe external ML model, REC model 200 can output that result as thequery's final classification result (assuming the external ML model'sresult has a higher confidence level than the results generated bysecondary ML models 204 and 206). Thus, with this enhancement, REC model200 can achieve high classification accuracy (via the external ML model)in those rare cases where secondary ML models 204 and 206 are unable toproduce a high-confidence result.

5. Hierarchical Anomaly Detection

Some data sets that need to be monitored for anomalies may have morethan a single “normal” class and a single “anomaly” class. For instance,a data set H may comprise “normal” data instances that can be furthercategorized into a “normal1” type or “normal2” type, as well as“anomaly” data instances that can be further categorized into an“anomaly1” type or an “anomaly2” type. For this kind of data set, itwould be useful to be able to quickly identify an unlabeled datainstance as being normal or anomalous (in order to take an appropriateaction if it is anomalous), but also be able to drill down and furtherclassify the data instance as being of a particular normal type (e.g.,norma1 or normal2) or a particular anomaly type (e.g., anomaly1 oranomaly2) in an accurate and efficient manner.

To address this need, FIG. 5 depicts a hierarchical version of REC model200 of FIG. 2 (i.e., hierarchical REC model 500) that includes a“low-resolution” primary ML model 502, two “high-resolution” primary MLmodels 504 and 506 (corresponding to the normal and anomaly classes),and four secondary ML models 508, 510, 512, and 514 (corresponding tothe normal1, normal2, anomaly1, and anomaly2 types). Low-resolutionprimary model 502 is coupled with high-resolution primary ML models 504and 506 via a data forwarder 516. In addition, high-resolution primaryML models 504 and 506 are coupled to secondary ML models 508, 510 and512, 514 via data forwarders 518 and 520 respectively.

In operation, when a query data instance h from data set H is received,REC model 500 can use low-resolution primary ML model 502 to classify has belonging to one of the classes “normal” or “anomaly.” Data forwarder516 can then forward h to an appropriate high-resolution primary MLmodel 504/506 (in accordance with the classification determined by thelow-resolution model), and that high-resolution primary ML model canfurther classify h as belonging to one of the types that are part ofthat class (i.e., either normal1/normal2 or anomaly1/anomaly2). Finally,if the classification result generated by the high-resolution primary MLmodel has a confidence level that falls below a classificationconfidence threshold, data instance h can be forwarded again to anappropriate secondary ML model 508-514 for additional classification ina manner similar to the classification workflow described for REC model200 of FIG. 2.

With this hierarchical architecture and approach, a given query datainstance can be quickly identified as being either normal or anomalousvia low-resolution primary ML model 502, which can be useful for takingan immediate action based on its normal or anomaly status. The querydata instance can then be further classified as belonging to one of thetypes that fall under the normal and anomaly classes via high-resolutionprimary ML models 504/506 and/or secondary ML models 508-514, in amanner that achieves all of the benefits described previously withrespect to REC model 200 (e.g., reduced memory footprint and trainingtime, low classification latency, etc.).

Certain embodiments described herein can employ variouscomputer-implemented operations involving data stored in computersystems. For example, these operations can require physical manipulationof physical quantities—usually, though not necessarily, these quantitiestake the form of electrical or magnetic signals, where they (orrepresentations of them) are capable of being stored, transferred,combined, compared, or otherwise manipulated. Such manipulations areoften referred to in terms such as producing, identifying, determining,comparing, etc. Any operations described herein that form part of one ormore embodiments can be useful machine operations.

Further, one or more embodiments can relate to a device or an apparatusfor performing the foregoing operations. The apparatus can be speciallyconstructed for specific required purposes, or it can be a generalpurpose computer system selectively activated or configured by programcode stored in the computer system. In particular, various generalpurpose machines may be used with computer programs written inaccordance with the teachings herein, or it may be more convenient toconstruct a more specialized apparatus to perform the requiredoperations. The various embodiments described herein can be practicedwith other computer system configurations including handheld devices,microprocessor systems, microprocessor-based or programmable consumerelectronics, minicomputers, mainframe computers, and the like.

Yet further, one or more embodiments can be implemented as one or morecomputer programs or as one or more computer program modules embodied inone or more non-transitory computer readable storage media. The termnon-transitory computer readable storage medium refers to any datastorage device that can store data which can thereafter be input to acomputer system. The non-transitory computer readable media may be basedon any existing or subsequently developed technology for embodyingcomputer programs in a manner that enables them to be read by a computersystem. Examples of non-transitory computer readable media include ahard drive, network attached storage (NAS), read-only memory,random-access memory, flash-based nonvolatile memory (e.g., a flashmemory card or a solid state disk), a CD (Compact Disc) (e.g., CD-ROM,CD-R, CD-RW, etc.), a DVD (Digital Versatile Disc), a magnetic tape, andother optical and non-optical data storage devices. The non-transitorycomputer readable media can also be distributed over a network coupledcomputer system so that the computer readable code is stored andexecuted in a distributed fashion.

Finally, boundaries between various components, operations, and datastores are somewhat arbitrary, and particular operations are illustratedin the context of specific illustrative configurations. Otherallocations of functionality are envisioned and may fall within thescope of the invention(s). In general, structures and functionalitypresented as separate components in exemplary configurations can beimplemented as a combined structure or component. Similarly, structuresand functionality presented as a single component can be implemented asseparate components.

As used in the description herein and throughout the claims that follow,“a,” “an,” and “the” includes plural references unless the contextclearly dictates otherwise. Also, as used in the description herein andthroughout the claims that follow, the meaning of “in” includes “in” and“on” unless the context clearly dictates otherwise.

The above description illustrates various embodiments along withexamples of how aspects of particular embodiments may be implemented.These examples and embodiments should not be deemed to be the onlyembodiments, and are presented to illustrate the flexibility andadvantages of particular embodiments as defined by the following claims.Other arrangements, embodiments, implementations and equivalents can beemployed without departing from the scope hereof as defined by theclaims.

What is claimed is:
 1. A method comprising: receiving, by a computersystem, a query data instance to be classified as belonging to one of aplurality of classes; generating, by the computer system, a firstclassification result for the query data instance using a first machinelearning (ML) model, the first classification result including apredicted class from among the plurality of classes for the query datainstance and a confidence level indicating a likelihood that thepredicted class is correct; comparing, by the computer system, theconfidence level with a classification confidence threshold; if theconfidence level is greater than or equal to the classificationconfidence threshold, outputting, by the computer system, the firstclassification result as a final classification result for the querydata instance; and if the confidence level is less than theclassification confidence threshold, forwarding, by the computer system,the query data instance to one of a plurality of second ML models. 2.The method of claim 1 wherein each of the plurality of second ML modelsis associated with a class in the plurality of classes, and wherein thequery data instance is forwarded to a second ML model associated withthe predicted class.
 3. The method of claim 1 wherein the plurality ofsecond ML models are trained to classify data instances which the firstML model cannot classify with confidence levels meeting or exceeding theclassification confidence threshold.
 4. The method of claim 1 furthercomprising: generating a second classification result for the query datainstance using the second ML model to which the query data instance hasbeen forwarded; and outputting the second classification result as thefinal classification result for the query data instance.
 5. The methodof claim 1 wherein each of the plurality of second ML models is based onan ML classifier that is larger in memory size than the first ML model.6. The method of claim 1 further comprising: receiving a training dataset comprising a plurality of training data instances; training thefirst ML model using the plurality of training data instances; andsubsequently to training the first ML model, for each training datainstance in the plurality of training data instances: generating aclassification result for the training data instance using the firstmachine learning (ML) model, the classification result including apredicted class for the training data instance and another confidencelevel indicating a likelihood that the predicted class for the trainingdata instance is correct; comparing said another confidence level with atraining confidence threshold; and if said another confidence level isless than the training confidence threshold: forwarding the trainingdata instance to another one of the plurality of second ML models; andtraining said another second ML model using the training data instance.7. The method of claim 6 wherein the training confidence threshold isgreater than or equal to the classification confidence threshold.
 8. Anon-transitory computer readable storage medium having stored thereonprogram code executable by a computer system implementing a methodcomprising: receiving a query data instance to be classified asbelonging to one of a plurality of classes; generating a firstclassification result for the query data instance using a first machinelearning (ML) model, the first classification result including apredicted class from among the plurality of classes for the query datainstance and a confidence level indicating a likelihood that thepredicted class is correct; comparing the confidence level with aclassification confidence threshold; if the confidence level is greaterthan or equal to the classification confidence threshold, outputting thefirst classification result as a final classification result for thequery data instance; and if the confidence level is less than theclassification confidence threshold, forwarding the query data instanceto one of a plurality of second ML models.
 9. The non-transitorycomputer readable storage medium of claim 8 wherein each of theplurality of second ML models is associated with a class in theplurality of classes, and wherein the query data instance is forwardedto a second ML model associated with the predicted class.
 10. Thenon-transitory computer readable storage medium of claim 8 wherein theplurality of second ML models are trained to classify data instanceswhich the first ML model cannot classify with confidence levels meetingor exceeding the classification confidence threshold.
 11. Thenon-transitory computer readable storage medium of claim 8 wherein themethod further comprises: generating a second classification result forthe query data instance using the second ML model to which the querydata instance has been forwarded; and outputting the secondclassification result as the final classification result for the querydata instance.
 12. The non-transitory computer readable storage mediumof claim 8 wherein each of the plurality of second ML models is based onan ML classifier that is larger in memory size than the first ML model.13. The non-transitory computer readable storage medium of claim 8wherein the method further comprises: receiving a training data setcomprising a plurality of training data instances; training the first MLmodel using the plurality of training data instances; and subsequentlyto training the first ML model, for each training data instance in theplurality of training data instances: generating a classification resultfor the training data instance using the first machine learning (ML)model, the classification result including a predicted class for thetraining data instance and another confidence level indicating alikelihood that the predicted class for the training data instance iscorrect; comparing said another confidence level with a trainingconfidence threshold; and if said another confidence level is less thanthe training confidence threshold: forwarding the training data instanceto another one of the plurality of second ML models; and training saidanother second ML model using the training data instance.
 14. Thenon-transitory computer readable storage medium of claim 13 wherein thetraining confidence threshold is greater than or equal to theclassification confidence threshold.
 15. A computer system comprising: aprocessor; and a non-transitory computer readable medium having storedthereon program code that, when executed, causes the processor to:receive a query data instance to be classified as belonging to one of aplurality of classes; generate a first classification result for thequery data instance using a first machine learning (ML) model, the firstclassification result including a predicted class from among theplurality of classes for the query data instance and a confidence levelindicating a likelihood that the predicted class is correct; compare theconfidence level with a classification confidence threshold; if theconfidence level is greater than or equal to the classificationconfidence threshold, output the first classification result as a finalclassification result for the query data instance; and if the confidencelevel is less than the classification confidence threshold, forward thequery data instance to one of a plurality of second ML models.
 16. Thecomputer system of claim 15 wherein each of the plurality of second MLmodels is associated with a class in the plurality of classes, andwherein the query data instance is forwarded to a second ML modelassociated with the predicted class.
 17. The computer system of claim 15wherein the plurality of second ML models are trained to classify datainstances which the first ML model cannot classify with confidencelevels meeting or exceeding the classification confidence threshold. 18.The computer system of claim 15 wherein the program code further causesthe processor to: generate a second classification result for the querydata instance using the second ML model to which the query data instancehas been forwarded; and output the second classification result as thefinal classification result for the query data instance.
 19. Thecomputer system of claim 15 wherein each of the plurality of second MLmodels is based on an ML classifier that is larger in memory size thanthe first ML model.
 20. The computer system of claim 15 wherein theprogram code further causes the processor to: receive a training dataset comprising a plurality of training data instances; train the firstML model using the plurality of training data instances; andsubsequently to training the first ML model, for each training datainstance in the plurality of training data instances: generate aclassification result for the training data instance using the firstmachine learning (ML) model, the classification result including apredicted class for the training data instance and another confidencelevel indicating a likelihood that the predicted class for the trainingdata instance is correct; compare said another confidence level with atraining confidence threshold; and if said another confidence level isless than the training confidence threshold: forward the training datainstance to another one of the plurality of second ML models; and trainsaid another second ML model using the training data instance.
 21. Thecomputer system of claim 20 wherein the training confidence threshold isgreater than or equal to the classification confidence threshold.